package com.byedu.course.controller;


import com.byedu.course.AnswerService;
import com.byedu.domain.course.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/answer")
public class AnswerController {

    @Autowired
    private AnswerService answerService;

    @ResponseBody
    @RequestMapping(value = "/answers/{questionId}", method = {RequestMethod.GET})
    public List<AnswerVO> getanswers(@PathVariable int questionId) {
        return answerService.listAnswersbyQuestionId(questionId);
    }

}
